package com.example.demo.Common;

import com.example.demo.Entity.Userinfo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

//获取当前用户
public class UserSessionTools {
    public  static Userinfo getLoginUser(HttpServletRequest req){
        HttpSession session=req.getSession(false);
        if(session!=null&& session.getAttribute(PublicValue.SessionValue)!=null){
            return (Userinfo) session.getAttribute(PublicValue.SessionValue);
        }
        return null;
    }
}
